package cn.dancepeak.user.service.impl;

import cn.dancepeak.user.domain.UserParam;
import cn.dancepeak.user.mapper.UserParamMapper;
import cn.dancepeak.user.service.IUserParamServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class UserParamServiceImplImpl implements IUserParamServiceImpl {
    @Autowired
    private UserParamMapper userParamMapper;

    @Override
    public Map<String,String> getAll() {
        //接收数据库数据 然后把数据转成map传给前端
        List<UserParam> list = userParamMapper.getAll();
        Map<String,String> map = list.stream().collect(Collectors.toMap(UserParam::getParamKey,UserParam::getParamValue));
        return map;
    }
}
